package com.jrtc.common;

import com.jrtc.base.entity.bo.Menu;

import java.util.List;
import java.util.stream.Collectors;

public class MenuCommon
{
    public static void getChildMenu(List<Menu> lstMenu, Menu parentMenu)
    {
        List<Menu> lstChildMenu = lstMenu.stream().filter(item -> item.getMenuId() != null && item.getMenuId().equals(parentMenu.getId())).collect(Collectors.toList());
        if (lstChildMenu.size() > 0)
        {
            parentMenu.getLstChildMenu().addAll(lstChildMenu);
        }
        for (Menu childMenu : lstChildMenu)
        {
            getChildMenu(lstMenu, childMenu);
        }
    }

}
